﻿using MilkTeaMachine.OfflineClient.ViewModels;
using MilkTeaMachine.OfflineClient.Views;
using ReactiveUI;

namespace MilkTeaMachine.OfflineClient;

public class AppViewLocator : IViewLocator
{
    public IViewFor? ResolveView<T>(T? viewModel, string? contract = null) =>
        viewModel switch
        {
            MainPageViewModel ctx => new MainPageUserControl { DataContext = ctx },
            AutoRunningPressKeyViewModel ctx => new AutoRunningPressKeyUserControl { DataContext = ctx },
            AutoRunningScanOrderViewModel ctx => new AutoRunningScanOrderUserControl { DataContext = ctx },
            FormulaInputViewModel ctx => new FormulaInputUserControl { DataContext = ctx },
            WeightingCalibrationViewModel ctx => new WeightingCalibrationUserControl { DataContext = ctx },
            FormulaSaveOrUpdateViewModel ctx => new FormulaSaveOrUpdateUserControl { DataContext = ctx },
            IngredientInputViewModel ctx => new IngredientInputUserControl { DataContext = ctx },
            IngredientCalibrationSelectorViewModel ctx => new IngredientCalibrationSelectorUserControl
                { DataContext = ctx },
            IngredientCalibrationViewModel ctx => new IngredientCalibrationUserControl { DataContext = ctx },
            FactorySettingsLoginViewModel ctx => new FactorySettingsLoginUserControl { DataContext = ctx },
            FactorySettingsViewModel ctx => new FactorySettingsUserControl { DataContext = ctx },
            HourGlassViewModel ctx => new HourGlassUserControl { DataContext = ctx },
            _ => null
        };
}